home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Supervisor's Toolkit
/
Network Supervisor's Toolkit.iso
/
menus
/
marxmenu
/
quick.mnu
< prev
next >
Wrap
Text File
|
1996-07-10
|
9KB
|
404 lines
Comment
==========================================================
Copyright 1990-91 by Marc Perkel * All right reserved.
This file is a quick menu system for you to get going with MarxMenu
quickly and esilly. It is written not only to be useful to us but to be
an example of what can be done with MarxMenu.
To add a choice to a menu simply use the AddChoice command
then add the appropiate Onkey statement.
The menu will make the size adjustments accordinaly.
Example:
AddChoice("Print Console",10)
...
...
OnKey Task(10)
PConsole
...
If you want to change the menu's center, pass the XY
coordinates to menu's CenterStretchBox procedure.
Example:
CenterStretchBox("Menu Header",10,10)
This will cause the menu to center at Col 10, Row 10
To control custom features, edit CUSTOM.INC and other INCLUDE Files.
=========================================================
EndComment
Var
FilePicked
;----- Personalize Your Screen Messages
StatusLineText = '*-<< Acme Manufacturing Company >>-*'
MenuTitle = "Joe Blow's Master Menu"
Comment
=================================
In order to add menu choices conditionally you would append the
choices to the end of the array after all the default choices
are set. For Example:
if DayOfWeek = Fri
AddChoice("Payroll Menu",10)
endif
Here is where menus are created.
=================================
EndComment
;----- Menu look and feel include files
Include 'CUSTOM.INC'
Comment
==========================================================
I have defined a couple of procedures called CenterStretchBox
CornerStretchBox which takes as parameters a menu title, array of
choices, and the XY coordinants of the center of the window. It then
displays all the choices and numbers them. This method allows you to
update the menu more quickly.
==========================================================
EndComment
;----- Main Menu
AddChoice('Accounting',1)
AddChoice('Word Processing',2)
AddChoice('SpreadSheet',3)
AddChoice('DataBase',4)
AddChoice('Graphics',5)
AddChoice('Communication',6)
AddChoice('Publishing',7)
AddChoice('Utilities',8)
CornerStretchBox ('Main Menu',11,6)
OnKey Task(1)
|Error('Put Code for Accounting here.')
OnKey Task(2)
|Error('Put Code for Word Processing here.')
OnKey Task(3)
|Error('Put Code for SpreadSheet here.')
OnKey Task(4)
|Error('Put Code for DataBase here.')
OnKey Task(5)
|Error('Put Code for Graphics here.')
OnKey Task(6)
|Error('Put Code for Communication here.')
OnKey Task(7)
|Error('Put Code for Publishing here.')
OnKey Task(8)
^Util
OnKey Esc
|LeaveMenu
;----- Util Menu
:Util
AddChoice('Format Disk Menu',1)
AddChoice('Dos Menu',2)
AddChoice('Dos Command Line',3)
AddChoice('Menu Utilities',4)
CornerStretchBox ('Utility Menu',43,6)
OnKey Task(1)
|SelectFormat
|LastKey = ' '
OnKey Task(2)
^Dos
OnKey Task(3)
|if ExistOnPath('DOLIST.EXE') > ''
DropTo DoList
|else
| Bat 'DropTo ' + ReadEnv('COMSPEC')
|endif
OnKey Task(4)
^MenuUtil
;----- Dos Menu
:Dos
AddChoice('Directory Master',1)
AddChoice('Pick Directory',2)
AddChoice('Memory Map',3)
AddChoice('Free Space',4)
AddChoice('Device Drivers',5)
AddChoice('Show Directory',6)
AddChoice('Backup Hard Disk',7)
AddChoice('Run a Program',8)
CenterStretchBox ('DOS Menu',38,15)
OnKey Task(1)
|if ExistOnPath('DM3.EXE') > ''
DropTo DM3
|else
DropTo DM
|endif
OnKey Task(2)
PD
OnKey Task(3)
RamMap
Pause
OnKey Task(4)
Free
Pause
OnKey Task(5)
Device
Pause
OnKey Task(6)
D/W
OnKey Task(7)
CD\
BACKUP C: A: /S
|Bat 'CD ' + Path
OnKey Task(8)
|FilePicked = ProgType
|if FilePicked > ''
| FilePicked = PickAFile(FilePicked,FilePicked + ' Files')
| if FilePicked > ''
| Bat FilePicked
| endif
|endif
;----- Menu Utilities
:MenuUtil
AddChoice('Edit this Menu',1)
AddChoice('View Include Files',2)
AddChoice('Edit Include Files',3)
AddChoice('Veiw a Menu File',4)
AddChoice('Edit a Menu File',5)
AddChoice('Run a Menu',6)
AddChoice('Load MarxHelp',7)
AddChoice('UnLoad MarxHelp',8)
CenterStretchBox ('Menu Utilities',38,15)
OnKey Task(1)
ME %MenuFileName
OnKey Task(2)
|FilePicked = PickAFile('*.INC','Include Files')
|ViewFile(FilePicked)
OnKey Task(3)
|FilePicked = GetIncludeFile
|if FilePicked > ''
| Bat 'ME ' + FilePicked
|endif
OnKey Task(4)
|FilePicked = PickAFile ('*.MNU','Menus')
|ViewFile(FilePicked)
OnKey Task(5)
|FilePicked = PickAFile ('*.MNU','Menus')
|if FilePicked > ''
| Bat 'ME ' + FilePicked
|endif
OnKey Task(6)
|FilePicked = PickAFile ('*.MNU','Menus')
|if FilePicked > ''
| Bat 'MARX ' + FilePicked
|endif
OnKey Task(7)
|MxCmd = 'MarxHelp'
OnKey Task(8)
|MxCmd = 'MarxHelp /U'
;----- This routines selects floppy disk format
Procedure SelectFormat
var Ch Message Option
DrawTheBox(20,12,42,4 + HeightDifference,'Format Floppy Disk Menu')
Writeln ' 1 - Format 360 5 - Format /S 360'
Writeln ' 2 - Format 1.2M 6 - Format /S 1.2M'
Writeln ' 3 - Format 720 7 - Format /S 720'
Write ' 4 - Format 1.4M 8 - Format /S 1.4M'
Ch = ReadKey
if Ch = '1'
Message = '360k Format with no System Files.'
Option = '/4'
elseif Ch = '2'
Message = '1.2m Format with no System Files.'
Option = ''
elseif Ch = '3'
Message = '720k Format with no System Files.'
Option = '/N:9/T:80'
elseif Ch = '4'
Message = '1.4m Format with no System Files.'
Option = '/N:18/T:80'
elseif Ch = '5'
Message = '360k Format with System Files.'
Option = '/4/S'
elseif Ch = '6'
Message = '1.2m Format with System Files.'
Option = '/S'
elseif Ch = '7'
Message = '720k Format with System Files.'
Option = '/N:9/T:80/S'
elseif Ch = '8'
Message = '1.4m Format with System Files.'
Option = '/N:18/T:80/S'
else
Return
endif
if DosVersionString >= '5.00'
Option = Option + '/U' ;unconditional
Option = Option + '/V:DOS' ;automatically adds volume label
endif
DrawTheBox(46,18,11,2 + HeightDifference,'Drive')
Writeln ' A:'
Write ' B:'
Ch = ReadKey
if Ch = Esc then Return
ExecFormat(Ch,Option,Message)
EndProc
;----- Execute FORMAT in a DOS Window
Procedure ExecFormat (Drv,Option,Message)
var FormatProg
FormatProg = ExistOnPath('FORMAT.EXE')
if FormatProg = '' then FormatProg = ExistOnPath('FORMAT.COM')
if FormatProg = ''
Error('FORMAT program not Found!')
Return
endif
BoxHeader = ' Formatting Drive ' + Drv + ': ' + Message + ' '
Shadow Off
DrawBox 1 4 80 21
Window 4 5 74 19
TextColor MenuHeaderFG MenuBG
Cursor Off
DosWindow
Writeln
Execute FormatProg + ' ' + Drv + ': ' + Option
EraseTopWindow
EndProc
;----- Choose Program Type
Procedure ProgType
AddChoice('COM File')
AddChoice('EXE File')
AddChoice('BAT File')
CornerStretchBox ('Program Type',19,16)
OnScreenOnly On
LastKey = ReadKey
if LastKey = 'A' then Return '*.COM'
if LastKey = 'B' then Return '*.EXE'
if LastKey = 'C' then Return '*.BAT'
if LastKey = Esc then Return ''
EndProc
;----- Select Include File
Procedure GetIncludeFile
var IncPath
IncPath = PathPart(ExistOnPath('CUSTOM.INC'))
IncPath = PickAFile(CleanFileName(IncPath + '\*.INC'),'Include Files')
if IncPath = '' then Return ''
DelFile(ForceExtension(%MenuFileName,'MRX'))
Return IncPath
EndProc
;----- View a File
Procedure ViewFile (Name)
if Name = '' then Return
BoxHeader = ' Viewing ' + Name + ' '
Shadow Off
DrawBox 1 4 80 21
TextColor MenuHeaderFG MenuBG
ViewTextFile Name
EndProc
Procedure PickAFile (Mask,Message)
var Files Choice MaxSize
ReadDirectory(Mask,Files)
MaxSize = Min(15,NumberOfElements(Files))
if MaxSize = 0
Error('No Choices!')
Return ''
endif
DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
Choice = PickOne(Files)
Return Choice
EndProc
;----- Display Error and Wait for a Key
Procedure Error (Err)
var Ch
BoxHeader = ' Error * Press any Key '
DrawBox 11 19 Max(27,length(Err) + 4) 3
Cursor Off
UseArrows Off
TextColor MenuHeaderFG MenuBG
WriteCenter Err
Write Char(7)
Ch = ReadKey
EraseTopWindow
EndProc